<%--
  Created by IntelliJ IDEA.
  User: bonoh
  Date: 2023/10/25
  Time: 13:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>triangle</title>
</head>
<body>
<%!
    public String getArea(double a,double b,double c){
        if ((a+b)>c&&(a+c)>b&&(b+c)>a) {
            double p = (a+b+c)/2.0;
            double area = Math.pow(p*(p-a)*(p-b)*(p-c),0.5);
            return String.valueOf(area);
        }else {
            return(a+","+b+","+c+","+"不能构成一个三角形，无法计算面积");
        }
    }
%>
<%
    String sideA = request.getParameter("sideA");
    String sideB = request.getParameter("sideB");
    String sideC = request.getParameter("sideC");
    double a = Double.parseDouble(sideA);
    double b = Double.parseDouble(sideB);
    double c = Double.parseDouble(sideC);
%>
<font color="blue" size="4">
    <p>我是被加载的文件，负责计算三角形的面积<br>
        给我传递的三边是：<%=a%>,<%=b%>,<%=c%><br>
        三角形的面积：<%=getArea(a,b,c)%></p>
</font>
</body>
</html>